<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title></title>
    <style type="text/css">
        body {
            width: 100%;
            height: 700px;
            margin-top: 0px;
            background: #008B8B;
            text-align: center;
        }

        div {
            display: inline-block;
            padding-top: 40px;
            padding-left: 0px;

        }

        h2 {
            font-family: "微软雅黑";
            font-size: 40px;
            color: black;
        }

        #reg {
            color: blue;
        }
    </style>
</head>

<body>
    <div>
        <h3>
            注册
        </h3>
        <p>
            用户名:<input type="text" class="username">
        </p>
        <p>
            密&emsp;码:<input type="password" class="psw">
        </p>
        <p>
            <button class="btn">注册</button>
        </p>
        <p>
            已有账号？<a href="登录.html">请登录</a>
        </p>
    </div>


    <script src="../../../jquery.min.js"></script>
    <script>
        $(".btn").click(function () {
            let username = $(".username").val()
            let password = $(".psw").val()
            $.ajax({
                url: `http://10.35.165.39/rgr`,
                data: {
                    username: username,
                    password: password
                },
                success(data) {
                    if (data === "success") {
                        alert("注册成功")
                        window.location.href = "http://10.35.165.39/log.html"
                    } else {
                        alert("注册失败")
                    }
                }
            })
        })
    </script>

</body>

</html>